package com.tsll.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 
 * @TableName borrowbook
 */
@Data
public class BorrowBook implements Serializable {
    /**
     * 借阅编号
     */
    private Integer id;

    /**
     * 借阅人员id
     */
    private Integer userId;

    /**
     * 图书id
     */
    private Integer bookId;

    /**
     * 借阅时间
     */
    @DateTimeFormat(pattern= "yyyy-MM-dd")
    @JsonFormat(pattern= "yyyy-MM-dd",timezone = "GMT+8")
    private Date borrowDate;

    /**
     * 借阅状态
     */
    private Integer status;

    /**
     * 归还时间
     */
    @DateTimeFormat(pattern= "yyyy-MM-dd")
    @JsonFormat(pattern= "yyyy-MM-dd",timezone = "GMT+8")
    /**
     * 归还时间
     */
    private Date returnDate;
    /**
     * 用户
     */
    private User user;
    /**
     * 图书
     */
    private Book book;
    /**
     * 图书类型
     */
    private Booktype booktype;
    /**
     * 驳回信息
     */
   private String reback;
    /**
     * 审核状态
     */
    private Integer examinestatus;

    public Integer getExaminestatus() {
        return examinestatus;
    }

    public void setExaminestatus(Integer examinestatus) {
        this.examinestatus = examinestatus;
    }

    public String getReback() {
        return reback;
    }

    public void setReback(String reback) {
        this.reback = reback;
    }


    public BorrowBook() {
    }

    public BorrowBook(Integer id, Integer userId, Integer bookId, Date borrowDate, Integer status, Date returnDate, User user, Book book, Booktype booktype, String reback, Integer examinestatus) {
        this.id = id;
        this.userId = userId;
        this.bookId = bookId;
        this.borrowDate = borrowDate;
        this.status = status;
        this.returnDate = returnDate;
        this.user = user;
        this.book = book;
        this.booktype = booktype;
        this.reback = reback;
        this.examinestatus = examinestatus;
    }

    public BorrowBook(Integer id, Integer userId, Integer bookId, Date borrowDate, Integer status, Date returnDate) {
        this.id = id;
        this.userId = userId;
        this.bookId = bookId;
        this.borrowDate = borrowDate;
        this.status = status;
        this.returnDate = returnDate;
    }



    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public Booktype getBooktype() {
        return booktype;
    }

    public void setBooktype(Booktype booktype) {
        this.booktype = booktype;
    }

    private static final long serialVersionUID = 1L;

    /**
     * 借阅编号
     */
    public Integer getId() {
        return id;
    }

    /**
     * 借阅编号
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 借阅人员id
     */
    public Integer getUserId() {
        return userId;
    }

    /**
     * 借阅人员id
     */
    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    /**
     * 图书id
     */
    public Integer getBookId() {
        return bookId;
    }

    /**
     * 图书id
     */
    public void setBookId(Integer bookId) {
        this.bookId = bookId;
    }

    /**
     * 借阅时间
     */
    public Date getBorrowDate() {
        return borrowDate;
    }

    /**
     * 借阅时间
     */
    public void setBorrowDate(Date borrowDate) {
        this.borrowDate = borrowDate;
    }

    /**
     * 
     */
    public Integer getStatus() {
        return status;
    }

    /**
     * 
     */
    public void setStatus(Integer status) {
        this.status = status;
    }

    /**
     * 归还时间
     */
    public Date getReturnDate() {
        return returnDate;
    }

    /**
     * 归还时间
     */
    public void setReturnDate(Date returnDate) {
        this.returnDate = returnDate;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        BorrowBook other = (BorrowBook) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getBookId() == null ? other.getBookId() == null : this.getBookId().equals(other.getBookId()))
            && (this.getBorrowDate() == null ? other.getBorrowDate() == null : this.getBorrowDate().equals(other.getBorrowDate()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getReturnDate() == null ? other.getReturnDate() == null : this.getReturnDate().equals(other.getReturnDate()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getBookId() == null) ? 0 : getBookId().hashCode());
        result = prime * result + ((getBorrowDate() == null) ? 0 : getBorrowDate().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getReturnDate() == null) ? 0 : getReturnDate().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", bookId=").append(bookId);
        sb.append(", borrowDate=").append(borrowDate);
        sb.append(", status=").append(status);
        sb.append(", returnDate=").append(returnDate);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}